<template>
  <view class="page">
    <!-- <CustomTop title="全部服务" /> -->
    <view class="padding">
      <ListAllService :list="$data.list" />
    </view>
    <PopupLogin />
  </view>
</template>

<script setup>
import { getCurrentInstance, reactive, ref, nextTick } from "vue";
import {
  onLoad,
  onShow,
  onHide,
  onReady,
  onPullDownRefresh,
  onShareAppMessage,
  onShareTimeline,
} from "@dcloudio/uni-app";
import { getAllServices } from "../../api/Interface/service";
import ListAllService from "./components/ListAllService.vue";
import CustomTop from "../../components/CustomTop.vue";
import { useImgSrc } from "../../hooks/useImg";
const Instance = getCurrentInstance();
const $vm = Instance?.appContext.config.globalProperties;
const $data = reactive({
  list: [],
});
const init = async () => {
  await getAllServices().then((res) => {
    if (res.code === 10000) {
      $data.list = res.data;
      $data.list.forEach((item) => {
        item._picurl = useImgSrc(item.cover);
        item._style = {
          background: `linear-gradient(to right, ${item.bgColor} 0%, #ffffff 80%);`,
          // background: `linear-gradient(to right, #F1EFFF 0%, #ffffff 80%);`,
        };
        // item._intro = item.intro.replace(new RegExp(" "), "<br />");
      });
    }
  });
  uni.stopPullDownRefresh();
};
onLoad((options) => {
  init();
});
onReady(() => {});
onPullDownRefresh(() => {
  init();
});
onShareAppMessage(() => {});
onShareTimeline(() => {});
</script>

<style lang="scss" scoped>
.page {
  background: #ffffff;
  width: 100vw;
  min-height: 100vh;
}
</style>
